package org.quarenden.demo.dao;

import org.quarenden.demo.model.Sequence;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public interface SequenceRepository extends JpaRepository<Sequence,String> {

    @Modifying(clearAutomatically = true)
    @Transactional
    @Query("update Sequence p set p.nextVal=?1 where p.name=?2")
    void updateByName(Integer value,String name);

}
